-
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Support for grapheme on fc.string
#5222
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ce08d15:
|
👋 A preview of the new documentation is available at: http://66c1abb39cb5a37554653c80--dubzzz-fast-check.netlify.app |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5222 +/- ##
==========================================
+ Coverage 94.73% 95.32% +0.59%
==========================================
Files 231 234 +3
Lines 9320 10414 +1094
Branches 2731 2774 +43
==========================================
+ Hits 8829 9927 +1098
+ Misses 491 487 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
👋 A preview of the new documentation is available at: http://66c446c6baf803d244ef3281--dubzzz-fast-check.netlify.app |
👋 A preview of the new documentation is available at: http://66c50df659c46d5e56b26357--dubzzz-fast-check.netlify.app |
👋 A preview of the new documentation is available at: http://66c511c599164e5b8a72a4cd--dubzzz-fast-check.netlify.app |
👋 A preview of the new documentation is available at: http://66c5155099164e603c72a71f--dubzzz-fast-check.netlify.app |
👋 A preview of the new documentation is available at: http://66c59b4d08eb95fa86d8611d--dubzzz-fast-check.netlify.app |
fc.string
👋 A preview of the new documentation is available at: http://66c6ecd471a60c8be0cf3877--dubzzz-fast-check.netlify.app |
Description
Strings are everywhere in programming, they have always been and will always be. They are our way to communicate with users in both ways: from them and to them. As such they are a key foundation for any piece of code.
Unfortunately strings are hard. When leaving the peaceful (biased) world of latin characters (ascii) we reach quickly a hard to grab new world. But we have to deal with it, strings are key for any program! As such fast-check wants to guide you through the subtle issues hat might come with strings by providing you with a comprehensive and efficient set of tools for them.
For instance: As a user you may have used Twitter/X. If so you probably heard of the 140-character limit (now bumped to 280 for European characters and still limited to 140 for CJK and Emojis). Actually by 140 they don't mean
tweet.length === 140
(counting chars), nor[...tweet].length === 140
(counting code-points), they mean 140 visual signs. And unfortunately it's most of the time what our users expect.This PR introduces an extra constraint called
unit
onfc.string
. This constraint could be filled with one our 5 presets. Among these presets'grapheme'
is planned to be the new default for version 4 and will behave as users may expect: it counts visual entities, neither chars, nor code-points. In order to help users finding their ideal granularity, we added other grapheme granularities: one for code-points (grapheme-composite) and one for chars (grapheme-ascii). The binary variants are supposed to be replacements for fullUnicode and other custom string versions we offered up to version 3 and that we plan to drop with v4.See #5221
Checklist — Don't delete this checklist and make sure you do the following before opening the PR
yarn bump
and flag the impacts properlyAdvanced
fc.string
and provided it with new capabilities